package cn.iocoder.yudao.module.security.dal.mysql.devicelog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.security.dal.dataobject.devicelog.SecurityDeviceLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.security.controller.admin.devicelog.vo.*;

/**
 * 终端日志 Mapper
 *
 * @author cai
 */
@Mapper
public interface SecurityDeviceLogMapper extends BaseMapperX<SecurityDeviceLogDO> {

    default PageResult<SecurityDeviceLogDO> selectPage(SecurityDeviceLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SecurityDeviceLogDO>()
                .likeIfPresent(SecurityDeviceLogDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(SecurityDeviceLogDO::getLogLevel, reqVO.getLogLevel())
                .betweenIfPresent(SecurityDeviceLogDO::getWarnTime, reqVO.getWarnTime())
                .eqIfPresent(SecurityDeviceLogDO::getWarnDesc, reqVO.getWarnDesc())
                .eqIfPresent(SecurityDeviceLogDO::getWarnDetail, reqVO.getWarnDetail())
                .betweenIfPresent(SecurityDeviceLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SecurityDeviceLogDO::getId));
    }

}